import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/view/layout/index.vue'
import contentRouter from './modules/content'
import userRouter from './modules/user'
import systemRouter from './modules/system'
import logRouter from './modules/log'

export const menus = [
  {
    path: 'index',
    name: 'Index',
    hidden:false,
    meta: {title: '首页',icon: 'odometer'},
    component: () => import('@/view/dashboard/index.vue'),
  },
  ...contentRouter,
  ...userRouter,
  ...systemRouter,
  ...logRouter
]

export const routes = [
  {
    path: "/",
    name: "layout",
    meta: {title: "layout",icon: 'odometer'},
    hidden:false,
    redirect: '/index',
    component: Layout,
    children:menus
  },
  // {
  //   path: '/init',
  //   name: 'Init',
  //   hidden:true,
  //   component: () => import('@/view/init/index.vue')
  // },
  {
    path: '/login',
    name: 'Login',
    hidden:true,
    component: () => import('@/view/login/index.vue'),
    meta: { title: '登录' }
  },
  { 
    path: '/404',
    name: '404',
    hidden:true,
    component: () => import('@/view/error/index.vue'),
    meta: { title: '404' }
  },
  { 
    path: '/login_cas',
    name: 'loginCas',
    hidden:true,
    component: () => import('@/view/loginCas/index.vue'),
    meta: { title: '登录系统' }
  },
  { 
    path: '/login_error',
    name: 'loginError',
    hidden:true,
    component: () => import('@/view/error/casError.vue'),
    meta: { title: '登录错误' }
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
